package com.welsmann.app.start.dao.impl;

import java.util.List;

import org.springframework.orm.hibernate3.HibernateTemplate;
import org.springframework.stereotype.Component;

import com.welsmann.app.start.dao.BaseDAO;
import com.welsmann.app.start.dao.INewsDAO;
import com.welsmann.app.start.entity.News;

@Component("NewsDAO")
public class NewsDAO extends BaseDAO implements INewsDAO {

	private HibernateTemplate _ht = null;

	@Override
	public News getNewsById(String nId) {
		_ht = new HibernateTemplate(super.sessionFactory);
		List<News> lstNews = _ht.find("from News where id = ?", nId);
		return lstNews != null && lstNews.size() > 0 ? lstNews.get(0) : null;
	}

}
